#include <iostream>
using std::cout;
using std::endl;

class Point{
public:
    void print(){
        cout << _x << "," << _y << endl;
    }

private:
    int _x;
protected:
    int _y;
};
//公有继承
//子类的内部：除了private无法访问其他均可以访问到
class Point3D : public Point{
public:
    void func(){
        //cout << _x << endl;error
        cout << _y << endl;
        print();
    }



};

//类的外部：只可以访问到public的成员
void test(){
    Point3D pt3d;
    pt3d.func();
    pt3d.print();
    //pt3d._x;
    //pt3d._y;
}

int main()
{
    test();
    return 0;
}

